package io.filecopy;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;

public class Demo02 {
    public static void main(String[] args) throws Exception {
        File file1 = new File("F://Test//T2//a.txt");
        File file2 = new File("F://Test//T2//a2.txt");
        FileReader fileReader = new FileReader(file1);
        FileWriter fileWriter = new FileWriter(file2);
        char[] chars = new char[1024];
        int length = 0;

        while ((length = fileReader.read(chars)) != -1) {
            fileWriter.write(chars);
        }

        fileWriter.flush();
    }
}
